package com.ibeeking.found.upms.g.rest.controller.v1;

import com.ibeeking.found.upms.g.rest.service.IGmcPermissionResourceService;
import com.ibeeking.found.upms.service.common.param.PermissionResourceParam;
import com.ibeeking.found.upms.service.common.param.ResourcePermissionParam;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName RolePermissionController控制器
 * @Description 全局用户管理
 * @Author ibeeking
 * @Date 2020-12-02 15:29
 **/
@RestController
@RequestMapping("/g/permissionResource/v1")
public class GmcPermissionResourceController {

    @Resource
    private IGmcPermissionResourceService permissionResourceServiceImpl;

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "通过权限Id修改权限资源关系信息")
    @PostMapping(value = "/modifyByPermissionId")
    public Boolean modifyByPermissionId(@RequestBody @Validated PermissionResourceParam permissionResourceParam) {
        return permissionResourceServiceImpl.modifyPermissionResourceByPermissionId(permissionResourceParam);
    }

    @Log(logType = OperateLogTypeEnum.MODIFY, describe = "通过资源Id修改权限资源关系信息")
    @PostMapping(value = "/modifyByResourceId")
    public Boolean modifyByResourceId(@RequestBody @Validated ResourcePermissionParam resourcePermissionParam) {
        return permissionResourceServiceImpl.modifyPermissionResourceByResourceId(resourcePermissionParam);
    }
}